if ($msg eq 'leave') {
  $self->sendMessage("I have been commanded to leave by ".$user."!");
  $self->leave();
}